package com.controller;

import com.entity.Student;
import com.service.StudentService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;

@Controller
public class StudentController {
    @Resource
    private StudentService service;
    @RequestMapping(value = "/dosome",method = RequestMethod.POST)
    public ModelAndView addStudent(Student student) {
        ModelAndView mv = new ModelAndView();
        mv.addObject("myname",student.getName());
        mv.addObject("myage",student.getAge());
//        redirect 不能访问web-inf下面的静态资源
        mv.setViewName("forward:/WEB-INF/view/show.jsp");
         return mv;
    }



}


